import java.util.Comparator;

class Clot1  {
    private String color;
    private String name;
    public int price;

    public Clot1(String color, String name, int price) {
        this.color = color;
        this.name = name;
        this.price = price;
    }

}
class CompareClot1 implements  Comparator<Clot1>{  //这个就是使用的比较器，通过这个类实例一个对象，然后通过它来进行比较
    @Override
    public int compare(Clot1 o1, Clot1 o2) {
        return o1.price- o2.price;
    }
}

    public class Test2 {
        public static void main(String[] args) {
            Clot1 shoe  = new Clot1("黑色","鸿星尔克",99);
            Clot1 coat = new Clot1("白色","李宁",100);
          CompareClot1 compareClot1 = new CompareClot1();
       int a=   compareClot1.compare(shoe,coat);
            System.out.println(a);
        }
    }

